package com.hhsjdesign.dynamicui.utils

import java.lang.reflect.Constructor

object DataCallerFactory {

    //创建数据请求对象
    fun makeDataCaller(dataType: String): DataCaller<*>? {
        val clazz = ClassCachePool.getClassByWidgetType(ClassCachePool.BUSINESS_CALLER, dataType)
            ?: return null
        val constructor: Constructor<*>? = clazz.getConstructor(String::class.java)
        return constructor?.newInstance(dataType) as? DataCaller<*>
    }

    @JvmStatic
    fun mapSize(): Int {
        return ClassCachePool.dataCallerSize()
    }

}